package com.buercorp.wangyu.file;

import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;

public class FileTest19 {
    public static void main(String[] args) throws IOException {
        File file = new File("src/main/resources/filejava/java.txt");
        System.out.println(file.getName());
        System.out.println(file.getPath());
        System.out.println(file.getParent());
        System.out.println(file.getCanonicalPath());
        // file.getAbsolutePath()，这会返回文件或目录的绝对路径
        System.out.println(file.getAbsolutePath());

        System.out.println(Paths.get(file.getAbsolutePath()).getRoot());
    }
}
